/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MenuAdministrador.java
 *
 * Created on 16/Jan/2012, 11:17:19
 */
package menus;

import desint.JanelaPrincipal;
import java.awt.CardLayout;
import javax.swing.JPanel;

/**
 *
 * @author Leonardo Lino
 */
public class MenuFuncionario extends javax.swing.JPanel {
    
    private JanelaPrincipal jp;
    private CardLayout cardlayout;

    /** Creates new form MenuAdministrador */
    public MenuFuncionario() {
        initComponents();
        
        //cardlayout = (CardLayout) (jp.cardHolder.getLayout());
    }
    
    
    public void setJanelaPrincipal(JanelaPrincipal jp){
        this.jp = jp;
    }
    
    public void setCardLayout(JPanel cardLayout){
        CardLayout cl = (CardLayout)(cardLayout.getLayout());
        this.cardlayout = cl;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        bGroupAdmin = new javax.swing.ButtonGroup();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        bUtil = new javax.swing.JButton();
        bAgenda = new javax.swing.JButton();
        bControl = new javax.swing.JButton();
        background = new javax.swing.JLabel();

        setPreferredSize(new java.awt.Dimension(95, 481));

        jLayeredPane1.setPreferredSize(new java.awt.Dimension(95, 100));

        bUtil.setIcon(new javax.swing.ImageIcon(getClass().getResource("/user2.png"))); // NOI18N
        bUtil.setToolTipText("Utilizadores");
        bGroupAdmin.add(bUtil);
        bUtil.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                bUtilMousePressed(evt);
            }
        });
        bUtil.setBounds(10, 40, 60, 60);
        jLayeredPane1.add(bUtil, javax.swing.JLayeredPane.DEFAULT_LAYER);

        bAgenda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/agenda_icon.png"))); // NOI18N
        bAgenda.setToolTipText("Agenda");
        bGroupAdmin.add(bAgenda);
        bAgenda.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                bAgendaMousePressed(evt);
            }
        });
        bAgenda.setBounds(10, 120, 60, 60);
        jLayeredPane1.add(bAgenda, javax.swing.JLayeredPane.DEFAULT_LAYER);

        bControl.setIcon(new javax.swing.ImageIcon(getClass().getResource("/control.png"))); // NOI18N
        bControl.setToolTipText("Control");
        bControl.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                bControlMousePressed(evt);
            }
        });
        bControl.setBounds(10, 210, 60, 60);
        jLayeredPane1.add(bControl, javax.swing.JLayeredPane.DEFAULT_LAYER);

        background.setIcon(new javax.swing.ImageIcon(getClass().getResource("/back_menu.png"))); // NOI18N
        background.setBounds(0, 0, 140, 480);
        jLayeredPane1.add(background, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 481, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    private void bControlMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bControlMousePressed

        cardlayout.show(jp.cardHolder, "cont");         jp.setMenu(JanelaPrincipal.MENU_CONTROL);         jp.setTexto("Control Entradas e Saidas");     }//GEN-LAST:event_bControlMousePressed

    private void bAgendaMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bAgendaMousePressed

        cardlayout.show(jp.cardHolder, "agen");         jp.setMenu(JanelaPrincipal.MENU_AGENDA);         jp.setTexto("Agenda");     }//GEN-LAST:event_bAgendaMousePressed

    private void bUtilMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bUtilMousePressed

        cardlayout.show(jp.cardHolder, "util");         jp.setMenu(JanelaPrincipal.MENU_UTILIZADOR);         jp.setTexto("Utilizadores");     }//GEN-LAST:event_bUtilMousePressed

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bAgenda;
    private javax.swing.JButton bControl;
    private javax.swing.ButtonGroup bGroupAdmin;
    private javax.swing.JButton bUtil;
    private javax.swing.JLabel background;
    private javax.swing.JLayeredPane jLayeredPane1;
    // End of variables declaration//GEN-END:variables
}
